//
//  TJCMainViewController.swift
//  aiLingVB
//
//  Created by mac on 17/1/4.
//  Copyright © 2017年 TjcLL. All rights reserved.
//

import UIKit

class TJCMainViewController: UITabBarController {

    override func viewDidLoad() {
        super.viewDidLoad()
        setValue(TJCTabBar(), forKey: "tabBar")
        
        addChildViewController(vc: TJCHomeViewController(), title: "首页", ImageName: "tabbar_home")
        addChildViewController(vc: TJCMessageViewController(), title: "消息", ImageName: "tabbar_message_center")
        addChildViewController(vc: TJCDiscoverViewController(), title: "发现", ImageName: "tabbar_discover")
        addChildViewController(vc: TJCProfileViewController(), title: "我", ImageName: "tabbar_profile")
        
    }
    private func addChildViewController( vc: UIViewController, title: String, ImageName: String ) {
        
        let vcNav = UINavigationController(rootViewController: vc)
        self.addChildViewController(vcNav)
        vc.tabBarItem.setTitleTextAttributes([NSForegroundColorAttributeName: UIColor.orange], for: .selected)
        
        vc.title                    = title
        vc.tabBarItem.image         = UIImage(named: ImageName)
        vc.tabBarItem.selectedImage = UIImage(named: "\(ImageName)_selected")?.withRenderingMode(UIImageRenderingMode.alwaysOriginal)
    }
}
